/**
 * 路由配置
 */
import { createRouter, createWebHistory } from 'vue-router'

/**
 * 路由路径
 */
const rotpaths = {
    Index: '/',
    Login: '/login',
    Home: '/home',
    Kanban: '/kanban',
    Settings: '/settings',
    User: '/user'
}

/**
 * 路由配置
 */
const routes = [
    {
        path: rotpaths.Index,
        name: 'index',
        redirect: `/login`,
        // meta: {
        //     title: 'index'
        // }
    },
    {
        path: rotpaths.Login,
        name: 'login',
        component: () => import('../views/Login.vue'),
        // meta: {
        //     title: '登录'
        // }
    },
    {
        path: rotpaths.Home,
        name: 'home',
        component: () => import('../views/Home.vue'),
        meta: {
            title: '首页'
        }
    },
    {
        path: rotpaths.Kanban,
        name: 'kanban',
        component: () => import('../views/Kanban.vue'),
        meta: {
            title: '看板'
        }
    },
    {
        path: rotpaths.Settings,
        name: 'settings',
        component: () => import('../views/Settings.vue'),
        meta: {
            title: '设置'
        }
    },
    {
        path: rotpaths.User,
        name: 'user',
        component: () => import('../views/User.vue'),
        meta: {
            title: '用户'
        }
    }
];

/**
 * 创建路由实例
 */
const appRouter = createRouter({
    history: createWebHistory(),
    routes
});

export { appRouter, rotpaths }

